//
//  NetworkTask.h
//  MIHelloNetwork101
//
//  Created by  on 13-1-21.
//  Copyright (c) All rights reserved.
//

#import <Foundation/Foundation.h>
#import "../ASIHttpRequest/ASIHTTPRequest.h"
#import "../ASIHttpRequest/ASIFormDataRequest.h"
#import "../SettingView/CarInfo.h"

#define NetworkTask_NotificationName_OnSuccess @"NetworkTask_NotificationName_OnSuccess"
#define NetworkTask_NotificationName_OnFail @"NetworkTask_NotificationName_OnFail"
#define NetworkTask_NotificationName_OnProgress @"NetworkTask_NotificationName_OnProgress"

#define NetworkTask_TaskID_Invalid @"NetworkTask_TaskID_Invalid"

@interface NetworkTask : NSObject

@property (nonatomic, copy)     NSString *indentifier;
@property (nonatomic, readonly) ASIHTTPRequest *request;
@property (nonatomic, readonly) int statusCode;
@property (nonatomic, readonly) NSData *resultData;
@property (nonatomic, readonly) NSDictionary *resultDict;

@property (nonatomic)           BOOL isNeedProgress;
@property (nonatomic, readonly) float progress;

@property (nonatomic, assign)   BOOL isDictionary;//返回值是否是JSON

@property (nonatomic, retain)   CarInfo* carInfo;

-(id)initWithGetUrl:(NSString *)url getArgs:(NSDictionary *)args;
-(id)initWithPostUrl:(NSString *)url postArgs:(NSDictionary *)args;
//upload picture
-(id)initWithPostUploadPicUrl:(NSString *)url postPicData:(NSData *)data;
// 断点续传
- (void)setDestFilePath:(NSString *)destFilePath tempFilePath:(NSString*)tempFilePath;
//send email
- (id)initWithPostSendEmailUrl:(NSString*)url emailData:(NSDictionary*)paramsDic;

@end
